import gtk
import plugins

class effect_list(gtk.HBox):
    def __init__(self, effect, change_fun):
        gtk.HBox.__init__(self)
        self.change_fun=change_fun
        self.ComboBox=gtk.combo_box_new_text()
        self.add(self.ComboBox)
        
        plugin_list=plugins.get_child_plugins()
        index=-1
        i=0
        for plugin in plugin_list:
            if plugin==effect:
                index=i
            elif plugin=="none" and index==-1:
                index=i
            i+=1
            self.ComboBox.append_text(plugin)
        
        self.ComboBox.set_active(index)
        self.ComboBox.connect("changed", self.changed)

    def get_selected(self):
        return self.ComboBox.get_active_text()
    
    def changed(self, obj):
        self.change_fun()
        